package com.lyl.serviceedu.controller;

import com.lyl.commonutils.R;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/auth/user")
@CrossOrigin
public class AuthController {

    @PostMapping("/login")
    public R login(){
//        System.out.println("params:"+params);
        //{"code":"20080","data":{"token":"admin"}}


        return R.ok().data("token","admin");
    }

    @PostMapping("info")
    public R info(@RequestParam Map<String,Object> params){
        System.out.println("params:"+params);
//        {"code":"20000","data":{"roles":["admin"],"name":"admin","avatar":""}}

        return R.ok().data("roles", Arrays.asList("admin")).data("name",params.get("token")).data("avatar","");
    }

}
